import 'package:flutter/material.dart';
import '../model/category.dart';

class ChildCategory with ChangeNotifier{
  
  List<BxMallSubDto> childCategoryList =  [];
  int childIndex = 0; //子类高亮索引
  String categoryId = '4'; //大类ID
  String subId = ''; //小类
  int page=1; //列表页数
  String noMoreText = '';



  //大类切换清零
  getChildCategoryList(List<BxMallSubDto> list, String id){
    childIndex=0;
    categoryId=id;
    page=1;
    noMoreText='';
    BxMallSubDto all = BxMallSubDto();
    all.mallSubId='';
    all.mallCategoryId='00';
    all.mallSubName='全部';
    all.comments='null';
    childCategoryList=[all];
    childCategoryList.addAll(list);
    notifyListeners();
  }

  //改变子类索引
  changeChildIndex(index, String id){
    childIndex=index;
    subId=id;
    page=1;
    noMoreText='';
    notifyListeners();
  }

  //增加page的方法
  addPage(){
    page++;
  }

  //改变noMoreText文本
  changeNoMore(String text){
    noMoreText=text;
    notifyListeners();
  }
}